SynchronizedKeyedCollection
Represents a thread-safe keyed collection that provides synchronization for its operations.
Herda de: KeyedCollection<T, T>
Implementa: ISynchronizedCollection<KeyValuePair<T, T>>, ISynchronizedCollection, ISynchronizable, ICollection<KeyValuePair<T, T>>, IEnumerable<KeyValuePair<T, T>>, IEnumerable
Construtores
protected SynchronizedKeyedCollection()
synchronizedKeyedCollection = SynchronizedKeyedCollection()
Initializes a new instance of the SynchronizedKeyedCollection class.
protected SynchronizedKeyedCollection(IEqualityComparer<TKey> comparer)
synchronizedKeyedCollection = SynchronizedKeyedCollection(comparer)
Initializes a new instance of the SynchronizedKeyedCollection class with the specified equality comparer.
- comparer
- The equality comparer to use when comparing keys.
Propriedades
public override TValue Item { set; }
synchronizedKeyedCollection.Item = value
Gets or sets the value associated with the specified key.
- key
- The key of the value to get or set.
Retorna: The value associated with the specified key.
private SynchronizedDictionary<TKey, TValue> SyncDict { get; }
value = synchronizedKeyedCollection.SyncDict
Gets the synchronized dictionary used internally by the collection.
public Lock SyncRoot { get; }
value = synchronizedKeyedCollection.SyncRoot
Gets the synchronization root object used to synchronize access to the collection.
Métodos
public override void Clear()
synchronizedKeyedCollection.Clear()
Removes all keys and values from the collection.
public Scope EnterScope()
result = synchronizedKeyedCollection.EnterScope()
Enters a synchronized scope for thread-safe operations on the collection.
Retorna: A Scope that represents the synchronized scope.
public override bool Remove(TKey key)
result = synchronizedKeyedCollection.Remove(key)
Removes the value with the specified key from the collection.
- key
- The key of the element to remove.
Retorna: true if the element is successfully found and removed; otherwise, false.